//
//  CatController.m
//  UI_04homeworkTomCat
//
//  Created by dllo on 16/6/8.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CatController.h"
#import "CatButton.h"
#import "CatImageView.h"
#import "CatSegmentedControl.h"




@interface CatController ()

@end

@implementation CatController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    
    // 界面状态
    [self alwaysAnimation];
    // 6个界面按钮
    [self creatSegmentedControl];
//    [self hideButton];
}

// 一直显示的界面(生气 和 肚子饿)
-(void)alwaysAnimation{
    CatImageView *angry = [CatImageView catImageViewWithImageName:@"angry_" withImageSuffix:@"jpg" withStartNumber:0 withImagesCounts:25];
    [self.view addSubview:angry];
    
    CatImageView *stomach = [CatImageView catImageViewWithImageName:@"stomach_" withImageSuffix:@"jpg" withStartNumber:0 withImagesCounts:33];
    stomach.frame = self.view.frame;
    [self.view addSubview:stomach];
    
    
    
}




// 6个界面按钮
-(void)creatSegmentedControl{
    CatButton *cymbal = [CatButton buttonWithPathName:@"cymbal" withPathSux:@"png"];
    cymbal.frame = CGRectMake(50, 300, 40, 40);
    [self.view addSubview:cymbal];
    [cymbal release];

    CatButton *drink = [CatButton buttonWithPathName:@"drink" withPathSux:@"png"];
    drink.frame = CGRectMake(50, 350, 40, 40);
    [self.view addSubview:drink];
    [drink release];

    CatButton *eat = [CatButton buttonWithPathName:@"eat" withPathSux:@"png"];
    eat.frame = CGRectMake(50, 400, 40, 40);
    [self.view addSubview:eat];
    [eat release];

    CatButton *fart = [CatButton buttonWithPathName:@"fart" withPathSux:@"png"];
    fart.frame = CGRectMake(320, 300, 40, 40);
    [self.view addSubview:fart];
    [fart release];

    CatButton *pie = [CatButton buttonWithPathName:@"pie" withPathSux:@"png"];
    pie.frame = CGRectMake(320, 350, 40, 40);
    [self.view addSubview:pie];
    [pie release];
    
    CatButton *scratch = [CatButton buttonWithPathName:@"scratch" withPathSux:@"png"];
   scratch.frame = CGRectMake(320, 400, 40, 40);
    [self.view addSubview:scratch];
    [scratch release];

    [cymbal addTarget:self action:@selector(cymbal:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)cymbal:(CatButton *)button{
    CatImageView *cymbal = [[CatImageView alloc]initWithImageName:@"cymbal_" withImageSuffix:@"jpg" withStartNumber:0 withImagesCounts:12];
    [self.view addSubview:cymbal];
    
    
}



// 左右脚额头button触发
//-(void)hideButton{
//    
//}










- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
